<template>
  <AtSteps
    :items="stepList"
    :current="value"
    :onChange="onChange"
  />
</template>

<script>
import Taro from '@tarojs/taro';
import UserAPI from "../../api/user.js"
export default {
  props:{
    value:{
      type: Number,
      default: 0
    }
  },
  watch:{
    value: {
      handler(newVal,oldVal) {
        console.log('watch value',newVal)
        this.stepList.forEach((item,index) => {
          if(newVal > index){
            item.status = "success"
          }else{
            delete item.status
          }
        })
      },
      immediate: true
    }
  },
  data() {
    return {
      stepList: [
        { title: '门店信息' },
        { title: '油品信息' },
        { title: '油品价格' },
        { title: '积分设置' },
        { title: '授权' },
      ]
    }
  },
  methods: {
    onChange(val){
      console.log(val)
      // var url = "business" + val
    }
  }
}

</script>
